package net.alan.modules.repository;

import net.alan.modules.bean.Daily;
import net.alan.modules.bean.DataStat;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;

import java.util.List;

/**
 * Author 李岩飞
 * Email eliyanfei@126.com
 * 2017/11/22
 */
public interface DailyRepository extends JpaRepository<Daily, Integer> {
    List<Daily> findByProjectIdAndDayOrderByIdDesc(Integer projectId, Integer day);

    @Query(value = "select user_id as l1,count(distinct day) as l2 from daily  where project_id = ?1 and month=?2 group by user_id", nativeQuery = true)
    public List<Object[]> statList(Integer projectId,int month);

}
